<!DOCTYPE html>

<html>

<head>

    <title>{$site_name}-会员充值</title>

    <meta name="keywords" content="{$site_seo_keywords}" />

    <meta name="description" content="{$site_seo_description}">

    <style type="text/css">
        #two-con{
            width: 700px;
        }

        #two-con .control-label {
            float: left;
            width: 90px;
            padding-top: 5px;
            text-align: right;
        }
        #two-con input.span4{
            width: 200px;
        }
        #two-con select{
            height: 34px;
            line-height: 34px;
        }
        #two-con select.span4{
            width: 214px;
        }
        /*tips*/
        #two-con .help-inline {
            display: block;
            margin-bottom: -20px;
            *zoom: 1;
            font-size: 14px;
        }
        #two-con .controls {
            *display: inline-block;
            *padding-left: 20px;
            margin-left: 110px;
            *margin-left: 0
        }
        .reposition{
            width: 350px;
            float: left;
        }
        #btn-order-print{
            padding-left: 10px;
            display: inline-block;
            height: 20px;
            text-decoration: none;
        }
        input[type="checkbox"] {
            margin: 0px !important;
        }
    </style>

    <tc_include file="Public:head" />

</head>

<body class="body-white" id="top">

<tc_include file="Public:nav" />

<div class="container tc-main">

    <div class="row">

        <div class="span2">

            <tc_include file="Public:usernav"/>

        </div>

        <div class="span10">
            <h3 style="margin-left:280px;margin-top:-10px;color: #ff0000;">床位添加</h3>

            <if condition="$cardnum">
                <form class="form-horizontal" id="dd" action="#">
                    <input type="hidden" value="{$userinfo.cardnum}" name="cardnum">
                    <input type="hidden" value="{$userinfo.name}" name="name">
                    <!-- 需要把之前的床位信息带过来，进行减去， -->
                    <input type="hidden" value="{$userinfo.bedid}" name="oldbunkid">
                    <input type="hidden" value="{$userinfo.usetime}" name="usetime">

                    <div class="control-group">
                        <label class="control-label" ><span style="color: red"></span>选择床位：</label>
                        <div class="controls">
                            <select name="area" id="area" style="width: 100px">
                                <foreach name="area" item="val">
                                        <option value="{$val['bunk_id']}~{$val['name']}" data-id="{$val.bunk_id}">{$val.name}</option>
                                </foreach>
                            </select>

                            <select name="house" id="house" style="width: 80px">
                                <option value="0">楼号</option>
                                <foreach name="house" item="val">
                                        <option value="{$val['bunk_id']}~{$val['name']}" data-id="{$val.bunk_id}">{$val.name}</option>
                                </foreach>
                            </select>

                            <select name="floor" id="floor" style="width: 90px">
                                <option value="0">楼层</option>
                                <foreach name="floor" item="val">
                                    <option value="{$val['bunk_id']}~{$val['name']}" data-id="{$val.bunk_id}">{$val.name}</option>
                                </foreach>
                            </select>

                        </div>
                    </div>

                    <div class="control-group">
                        <div class="controls">
                            <select name="room" id="room" style="width: 100px">
                                <option value="0">房间</option>
                                <foreach name="room" item="val">
                                    <option value="{$val['bunk_id']}~{$val['name']}" data-id="{$val.bunk_id}">{$val.name}</option>
                                </foreach>
                            </select>
                            <select name="bed" id="bed" style="width:120px">
                                <option value="0">床号</option>
                                <foreach name="bed" item="val">
                                    <option value="{$val['bunk_id']}~{$val['name']}" data-use="{$val['totaluse']-$val['used']}" data-id="{$val.bunk_id}">{$val.name}({$val.totaluse})</option>
                                </foreach>
                            </select>
                            <input type="number" id="use" name="use" onkeyup="monthreduce()" style="width:40px;height: 15px"> 月
                            <span style="color: red" id="usetime"></span>

                        </div>
                    </div>

                    <div class="control-group" style="margin-top: 20px;">
                        <div class="controls">
                            <button class="btn btn-primary js-ajax-submit span4" type="button" style="margin-left: 0px" id="subbtn">确定</button>
                        </div>
                    </div>
                </form>

                    <hr>

                    <div id="two-con" style="margin-left: 70px">
                        <div>
                            <div class="control-group reposition">
                                <label class="control-label"><span style="color: red;">*</span>会员卡号:</label>
                                <div class="controls">
                                    <input type="text" value="{$userinfo.cardnum}" disabled name="cardnum" class="span4" id="vipcardnum">
                                </div>
                            </div>
                            <div class="control-group reposition">
                                <label class="control-label" >姓名:</label>
                                <div class="controls">
                                    <input type="text" id="name" name="uname" disabled value="{$userinfo.name}" class="span4" >
                                    <div style="clear: both;"></div>
                                </div>
                            </div>
                            <div class="control-group reposition">
                                <label class="control-label" ><span style="color: red;">*</span>会员级别:</label>
                                <div class="controls">
                                    <input type="text" value="{$userinfo.cardname}" disabled name="cardname" class="span4">
                                </div>
                            </div>
                            <div class="control-group reposition">
                                <label class="control-label" for="usedstore">可用储值:</label>
                                <div class="controls">
                                    <input type="text" id="usedstore" disabled name="usedstore" value="{$userinfo['usedstore']/100}" class="span4">
                                </div>
                            </div>
                            <if condition="$userinfo['usetime']">
                                <div class="control-group reposition">
                                    <label class="control-label" >床位信息:</label>
                                    <div class="controls">

                                        <input type="text" style="width: 355px" disabled name="bedinfo" value="{$userinfo.areaname}-{$userinfo.housename}-{$userinfo.floorname}-{$userinfo.roomname}-{$userinfo.bedname}-{$userinfo.usetime}个月" class="span4">

                                    </div>
                                </div>
                            </if>
                            <div style="clear: both"></div>
                <else/>
                            <div>
                                <form action="{:leuu('User/Store/add')}" style="margin: 90px 0 0 20px;">
                                    请输入会员卡号：<input name="cardnum" type="number">
                                    <input type="submit" name="提交" class="btn" style="vertical-align:top;">
                                </form>
                            </div>
                        </div>

                    </div>
            </if>


        </div>

    </div>

</div>

<!-- /container -->

<tc_include file="Public:scripts" />

<script src="__PUBLIC__/js/tools.js?num=1.2"></script>
<script src="__PUBLIC__/js/jquery.print.js"></script>
<script type="text/javascript">

    $('#subbtn').click(function() {
        $.post("{:leuu('User/Store/doaddbunk')}",$('#dd').serialize(),function(data){
            document.getElementById('subbtn').disabled=true;
            if(data.status == 1) {
                if(data.url) {
                    window.location.href=data.url;
                } else {
                    location.reload();
                }
            } else {
                alert(data.info);
                document.getElementById('subbtn').disabled=false;
            }
        })
    });

</script>

</body>

</html>